<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" 
import="orm.*" import="java.util.*"errorPage="errorPage.jsp" %>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
<%
   List courselist = (List)session.getAttribute("courseList");
   boolean flag = false;  
 %>
 <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>成绩管理</title>
<link href="css/tStyles.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="js/AjaxRequest.js"></script>
<script language="javascript" >
    function onerror(){
	   // alert("很抱歉，服务器出现错误.");
    }
    function showTestlist()
    {
        var cid = this.course.value;
        if(cid==-1)
        {
           document.getElementById("testlist").innerHTML="<option value=\"-1\" selected=\"selected\">请选择考试</option>";
           return;
        }
        var loader=new net.AjaxRequest("gradeManagement.do?action=getTests&courseId=" + cid,showT,onerror,"GET");
    }
    function showT()
    {
        document.getElementById("testlist").innerHTML=this.req.responseText;
    }
    function getValue()
    {
      return this.testlist.value;
    }
    function viewStuScores()
    {
       
       var testid = this.testlist.value;
       if(testid==-1)
       {
           <% flag = false; %>
           return;
       }
       <% flag = true; %> 
       document.getElementById("detail").src="teacher/scoreTable.jsp?testId="+testid;
      /* var loader = new net.AjaxRequest("gradeManagement.do?action=stuScores&testId="+testid,showDetail,onerror,"Get");*/
    }
    function showDetail()
    {       
        document.iframe.getElementById("detail").innerHTML = this.req.responseText;
    }
    function analyse()
    {
      <% if(flag==false) {  %>
           return;
       <% }else{ %>
       window.location.href="gradeManagement.do?action=analyse&testId="+this.testlist.value;
    }

</script>
</head>

<body>
	<!-- CONTAINER START -->
<div id = "container">
<!-- HEADER START -->
        <div id = "top">
        	<div id = "navigation">
            	<html:link page="/teacher/teacher.jsp" styleClass = "link">&nbsp;&nbsp;&nbsp;&nbsp;首页</html:link>
                <html:link page="/teacher/notice.jsp" styleClass = "link">&nbsp;&nbsp;&nbsp;&nbsp;通知</html:link>
                <html:link action="manageQuestions.do?action=startManagement" styleClass = "link">&nbsp;&nbsp;&nbsp;&nbsp;题库</html:link>
                <html:link action="manageKnowledges.do?action=startManagement" styleClass = "link">&nbsp;&nbsp;&nbsp;&nbsp;知识点</html:link>
                <html:link action="manageTemplates.do?action=startManagement" styleClass = "link">&nbsp;&nbsp;&nbsp;&nbsp;试卷模板</html:link>
                <html:link action="gradeManagement.do?action=startMana" styleClass = "link">&nbsp;&nbsp;&nbsp;&nbsp;成绩管理</html:link>
                <html:link page="/teacher/studentMana.jsp" styleClass = "link">&nbsp;&nbsp;&nbsp;&nbsp;学生管理</html:link>
            </div>
        </div>
        <!-- HEADER END -->
        
<!-- LOGIN START -->
        <div id = "login">
        	<div id = "name">
            </div>
   	    <html:link page="/teacher/teacherInfo.jsp" styleClass="viewInfo">·查询个人信息</html:link>
          	<p><html:link page="/teacher/teaModifyPwd.jsp" styleClass="modifyPwd">·修改密码</html:link></p>
            <p><html:link page="/teacher/letter.jsp" styleClass="letter">·站内信</html:link></p>
            <p><html:link forward="logout" styleClass="logout">·注销登录</html:link></p>
</div>
        <!-- LOGIN END -->
        
        <!-- CLOCK START -->
  <div id = "clock">
        	<iframe src="index/clock.html" height="407" width="296" frameborder="0" scrolling="no"
            		marginheight="0" marginwidth="0" id="clockFrame" name="clockFrame"></iframe>
</div>
        <!-- CLOCK END -->
        
        <!-- MAIN START -->
      	<div id = "main">
        	<center>
          <div id="cj_date"><br /><br />
            <span class="text"><strong>&nbsp;&nbsp;课程名称</strong></span>
            <label>
              <select name="course" id="course" style="width:80px;" onchange="javascript:showTestlist();">
              <%  for(int i=0;i<courselist.size();i++)
                  { %>          
                  <option value=<%=((Course)courselist.get(i)).getCourseid() %>>
                  <%=((Course)courselist.get(i)).getCoursename() %> </option>
                  <% 
                  }%>
              <% if(courselist.size()==0){ %>
                 <option value="-1" selected="selected">您暂无无任何课程</option>
                 <% }else{ %>
                 <option value="-1" selected="selected">请选择课程</option>
                 <% }
                 }%>
              </select>
            </label>
            <span class="text">考试名称：</span>
<label>
        <select name="testlist" id="testlist" style="width:65px;" >
          <option value="-1" selected="selected">请选择考试</option>              
        </select>
        </label>
            <label>           
              <input type="button" name="choose" id="choose" value="选择" style="width:60px; height:26px;" onclick="viewStuScores();"/>
              <input type="button" name="chartAnalyse" id="chartAnalyse" value="成绩分析" style="width:90px; height:26px;" onclick="analyse();"/>
            </label>
          </div>
          <div id="ls_chengji">
            <p><span class="text"><strong>&nbsp;&nbsp;查询结果</strong></span><strong>：</strong></p>
            <iframe  src=""  height="400" width="500" frameborder="0"
            		marginheight="0" marginwidth="0" id="detail" name="stuScoreTable"></iframe>           		
            <!--<table width="483" height="227" border="1" cellpadding="2" cellspacing="2" id=""  style=" color:#000000">
            
            </table>-->
          </div></center>
        </div>
   	<!-- MAIN END -->
        
   	<!-- FOOTER START -->
   	<div id = "footer">
</div>
   	<!-- FOOTER END -->
        
</div>
    <!-- CONTAINER END -->
    
</body>
</html>
